import request from '@/utils/request'

/**
 * 人员下拉数据
 *
 * @export
 * @param {*} params ( 部门ID )  { deptId }
 * @returns
 */
export function fetchDropAccountAllList(params, options) {
  params = params || { deptId: 0 } // 传0 查全部
  return request({
    url: '/ComponentController/getAccountDropDown',
    method: 'post',
    params,
    ...options
  })
}

/**
 * 车辆下拉数据
 *
 * @export
 * @param {*} params { orgId }
 * @returns
 */
export function fetchDropCarAllList(params, options) {
  return request({
    url: '/ComponentController/getCarDropDown',
    method: 'post',
    params,
    ...options
  })
}

/**
 * 部件下拉数据
 *
 * @export
 * @param {*} params ( 部件类别 ) { type } 0全部 1片区，2道路，3普通部件 4 片区和道路
 * @returns
 */
export function fetchDropPartAllList(params, options) {
  params = params || { type: 0 }
  return request({
    url: '/ComponentController/getComponentDropDown',
    method: 'post',
    params,
    ...options
  })
}

/**
 * 部件类型下拉
 *
 * @export
 * @param {*} params { orgId }
 * @returns
 */
export function fetchDropPartTypeList(params, options) {
  return request({
    url: '/ComponentController/selectComponentTypeDropdown',
    method: 'post',
    params,
    ...options
  })
}

/**
 * 部门下拉数据
 *
 * @export
 * @param {*} params ( 无 )
 * @returns
 */
export function fetchDropDeptAllList(params, options) {
  return request({
    url: '/ComponentController/getDeptDropDown',
    method: 'post',
    params,
    ...options
  })
}

/**
 * 设备下拉
 *
 * @export
 * @param {*} params { bindType } 1.人员 2.车辆 3.部件
 * @param {*} options
 * @returns
 */
export function fetchDropDeviceList(params, options) {
  return request({
    url: '/ComponentController/selectDeviceDropdown',
    method: 'post',
    params,
    ...options
  })
}

/**
 * 数据字典下拉
 *
 * @export
 * @param {*} params { groupName }
 * @param {*} options
 * @returns
 */
export function fetchDropDictionaryList(params, options) {
  return request({
    url: '/ComponentController/getDictionaryDropDown',
    method: 'post',
    params,
    ...options
  })
}

/**
 * 机构下拉
 *
 * @export
 * @param {*} params (无)
 * @param {*} options
 * @returns
 */
export function fetchDropOrgAllList(params, options) {
  return request({
    url: '/ComponentController/getOrgDropDown',
    method: 'post',
    params,
    ...options
  })
}

/**
 * 岗位下拉
 *
 * @export {*} params { deptId }
 * @returns
 */
export function fetchDropPostList(params, options) {
  return request({
    url: '/pc/base/post/selectByDropdownList',
    method: 'post',
    params,
    ...options
  })
}

/**
 * 角色下拉
 *
 * @export {*} params { orgId }
 * @returns
 */
export function fetchDroptRoleList(params, options) {
  return request({
    url: '/ComponentController/selectRoleDropdown',
    method: 'post',
    params,
    ...options
  })
}

/**
 * 获取机构下的所有用户
 *
 * @export
 * @param {*} params { orgId }
 * @param {*} options
 * @returns
 */
export function fetchDropAllAccountList(params, options) {
  return request({
    url: '/ComponentController/selectAllAccountDropdown',
    method: 'post',
    params,
    ...options
  })
}

/**
 * 获取部门人员树
 * @param {*} params { orgId }
 * @returns
 */
export function commonGetDeptUserTree(data) {
  return request({
    url: '/common/getDeptUserTree',
    method: 'post',
    data
  })
}

/**
 * 获取部门树
 * @param {*} params { orgId }
 * @returns
 */
export function commonGetDeptTree(data = {}) {
  return request({
    url: '/common/getDeptTree',
    method: 'post',
    data
  })
}

/**
 * 获取部门下拉
 * @param {*} params { orgId }
 * @returns
 */
export function selectDeptList(data) {
  return request({
    url: '/common/dropdown/selectDeptList',
    method: 'post',
    data
  })
}

/**
 * 获取职务下拉
 * @param {*} params { orgId }
 * @returns
 */
export function selectDutyList(data) {
  return request({
    url: '/common/dropdown/selectDutyList',
    method: 'post',
    data
  })
}
/**
 * 获取机构下拉
 * @param {*} params { orgId }
 * @returns
 */
export function selectOrgList(data) {
  return request({
    url: '/common/dropdown/selectOrgList',
    method: 'post',
    data
  })
}

/**
 * 获取总部视角
 * @param {*} params { orgId }
 * @returns
 */
export function getDeptKpiTree(data) {
  return request({
    url: '/common/getDeptKpiTree',
    method: 'post',
    data
  })
}

/**
 * 获取项目区域视角
 * @param {*} params { orgId }
 * @returns
 */
export function getProAreaKpiTree(data) {
  return request({
    url: '/common/getProAreaKpiTree',
    method: 'post',
    data
  })
}
